package com.house.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Value("${filemappingpath}")
    private String FileMappingPath;
    /**
     * 文件映射配置类
     * @param registry
     */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/UploadFiles/**").addResourceLocations("file:"+FileMappingPath+"/UploadFiles/");
        registry.addResourceHandler("/Images/WeChat/**").addResourceLocations("classpath:/static/Images/WeChat/");
    }
}
